<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button class="btn">修改</button>
    <script>
document.querySelector('.btn').onclick = function(){
    let p =new Promise(
        (resolve,reject)=>{
            console.log(6666);
            setTimeout(()=>{
                let money = parseInt(Math.random()*300)
                console.log(money);
                if (money>=100) {
                    resolve('6翻了')
                }else{
                    reject('sb')
                }
            })
        })
        p.then(res=>{
            console.log(res);
        }).catch((err)=>{
            console.log(err);
        })
}


    </script>
</body>
</html>